module.exports = (sql, params = null) => {
  const mysql = require("mysql");
  const conn = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "123456",
    database: "bigevent",
  });
  return new Promise((resolve, reject) => {
    conn.query(sql, params, (err, data) => {
      err ? reject(err) : resolve(data);
    });
    conn.end();
  }).catch((err) => console.log(err.message));
};
